package com.android.wuziqi;

import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.android.jay.music.R;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

/**
 * Created by wzp on 2020/3/3 0003.
 * <p>
 * 描述  ：todo
 */
public class WzqActivity extends Activity implements WuziqiTabel.winnerLisenter {

    private WuziqiTabel mWuziqi;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wzq);
        mWuziqi = findViewById(R.id.wuziqi);
        mWuziqi.setWinnerLisenter(this);
    }

    @Override
    public void onWinnerLisenter(boolean whitewin) {

        AlertDialog alertDialog = new AlertDialog.Builder(this)
                .setTitle("提示")
                .setMessage(whitewin ? "whitewin" : "blackwin")
                .setNegativeButton("退出", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                })
                .setPositiveButton("再来一局", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        mWuziqi.star();
                    }
                })
                .create();
        alertDialog.show();
    }
}
